Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to ensure hasAttribute is a function #3929

Merged
merged 1 commit into from
Jan 11, 2017

Conversation

stramel
Copy link
Contributor

@stramel stramel commented Jan 10, 2017

Description

For elements which parent doesn't have hasAttribute it needs do another check to prevent erroring out.

Specific Changes proposed

Added a check to ensure the tag's parentNode has the hasAttribute function

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

For elements which parent doesn't have `hasAttribute` it needs do another check to prevent erroring out.
@gkatsev
Copy link
Member

gkatsev commented Jan 11, 2017

Can you elaborate on when the tag's parentNode is not going to have a hasAttribute method? Want to understand the usecase better before pulling it in.

@stramel
Copy link
Contributor Author

stramel commented Jan 11, 2017

@gkatsev I am using the <template> element which creates a DocumentFragment to encompass a video player.

I am specifically creating a Polymer component that extends the video element. When I use the ready lifecycle callback the local DOM has been initialized but not attached to the document. This means that the DocumentFragment is the parent. Using the attached lifecycle callback, does not hit this case since it has been attached and the parent is then a DOM element. However, the attached callback runs each time the element is attached. I was concerned there may be issues with videojs attempting to initialize the element multiple times. Thus I chose to use the ready callback which will only be called once.

Hope this clarifies things!

REFRENCES:

@gkatsev
Copy link
Member

gkatsev commented Jan 11, 2017

Ah, yup, makes sense! Thanks.

@gkatsev gkatsev merged commit bbe8253 into videojs:master Jan 11, 2017
@stramel stramel deleted the patch-1 branch January 11, 2017 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants